from captcha.image import ImageCaptcha
import random
import time

captcha_array=list("0123456789abcdefghijklmnopqrstuvwxyz")
captcha_size=4

if __name__ == '__main__':
    for i in range(50000):
        img = ImageCaptcha()
        img_text = "".join(random.sample(captcha_array, captcha_size))
        img_path = "./datasets/train/{}_{}.png".format(img_text, int(time.time()))
        print(img_text)
        print(img_path)
        img.write(img_text, img_path)

    for i in range(1000):
        img = ImageCaptcha()
        img_text = "".join(random.sample(captcha_array, captcha_size))
        img_path = "./datasets/test/{}_{}.png".format(img_text, int(time.time()))
        print(img_text)
        print(img_path)
        img.write(img_text, img_path)